package main

import (
	"chat/models"

	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

func main() {

	db, err := gorm.Open(mysql.Open("root:yangtj1013@tcp(127.0.0.1:3306)?charset=utf8mb4&parseTime=True&loc=Local"), &gorm.Config{})
	if err != nil {
		panic("failed to connect database")
	}
	db.AutoMigrate(&models.Userbasic{})
	user := &models.Userbasic{}
	user.Name = "test"
	user.Password = "123456"
	user.Phone = "12345678901"
	db.Create(user)

}
